<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@  taglib uri="/struts-tags" prefix="s"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<style>
	a{
		text-decoration: none;
		font: black;
	}
	.pageNo{
		width: 25px;
		height: 25px;
		background-color:#8600FF;
		border: 1px solid #007500;
		text-align: center;
		line-height: 25px;
	}
	.pageNo:HOVER{
		background-color: #FF79BC;
	}
	/*页面太美不敢看！*/
	

</style>
			<div>
    			这是第 ${page.currentPage }/${page.totalPage } 页&nbsp;&nbsp;
    			<c:if test="${page.currentPage>1 }">
    				<a href="${page.requestURI }?pageNum=${page.startNum -1}">上一页</a>
    			</c:if>
    			<a href="${page.requestURI }?pageNum=1" class="pageNo">1</a>
    			...&nbsp;&nbsp;
    			<c:forEach var="numb" begin="${page.startNum }" end="${page.endNum }" step="1">
    				<a href="${page.requestURI }?pageNum=${numb }" class="pageNo">${numb }</a>&nbsp;&nbsp;
    			</c:forEach>
    			&nbsp;&nbsp;...
    			<a href="${page.requestURI }?pageNum=${page.totalPage }" class="pageNo">${page.totalPage }</a>&nbsp;&nbsp;
    			<c:if test="${page.currentPage<page.totalPage }">
    				<a href="${page.requestURI }?pageNum=${page.currentPage +1}">下一页</a>
    			</c:if>
    			&nbsp;&nbsp;&nbsp;
    			第<input type="text" name="pageNum" style="width: 30px;" id="pageNo"/>页&nbsp;&nbsp;
    			 <input type="button" id="butt" onclick="return checkInput(document.getElementById('pageNo'),'${page.totalPage }','${page.requestURI }')" value="GO"/>
			</div>
   

     <script type="text/javascript">
		function checkInput(pageNo,totalPage,uri){
			var num = pageNo.value;
			if(num=='' || num==null){
				alert("请输入页码");
				return ;
			}
			if(!num.match("^[0-9]*$")){
				alert("输入格式有误，请输入数字页码");
				document.getElementById('pageNo').value = "";
				return ;
			}
			if(parseInt(num, 10) > parseInt(totalPage, 10)){
				alert("输入的页码不能超过 "+totalPage);
				document.getElementById('pageNo').value = "";
				return ;
			}
			var uriAdd = uri+"?pageNum="+num;
			window.location.href = uriAdd;
			return true;
		}
		
	  </script>
